﻿<sdk:ChildWindow
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    xmlns:comments="clr-namespace:Earthwatchers.UI.GUI.Controls.Comments"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:ext="clr-namespace:Earthwatchers.UI.Extensions"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="Earthwatchers.UI.GUI.Controls.Comments.CommentScreen" 
    Width="400" Height="400" 
    Style="{StaticResource GPDefaultChildWindow}"
    Title="{Binding Path=Comments1, Source={StaticResource Labels}}">
    <sdk:ChildWindow.Resources>
        <ext:CommentDeleteVisibilityConverter x:Key="commentDeleteVisibilityConverter" />
    </sdk:ChildWindow.Resources>
    <Grid x:Name="LayoutRoot" Margin="2">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <ScrollViewer 
            HorizontalScrollBarVisibility="Disabled" 
            VerticalScrollBarVisibility="Auto" 
            Background="Transparent"
            BorderThickness="0"
            Margin="0,0,0,5">
            <ItemsControl x:Name="commentList" Margin="0,5,0,5" BorderThickness="0" Background="Transparent">
                <ItemsControl.ItemTemplate>
                    <DataTemplate>
                        <Grid Margin="10,0,10,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                                <RowDefinition />
                            </Grid.RowDefinitions>
                            <TextBlock Text="{Binding FullName}" FontWeight="Bold" Foreground="#FF414141" FontSize="11" />
                            <TextBlock Grid.Row="1" Text="{Binding UserComment}" Foreground="#FF414141" FontSize="11" TextWrapping="Wrap" />
                            <TextBlock Grid.Row="2" Text="{Binding Published}" Foreground="#FF7c8e24" FontSize="11" />
                            <Border Grid.Row="3" Grid.ColumnSpan="2" BorderThickness="1" BorderBrush="#FFcdcdcd" Height="1" Margin="0,10,0,2" />
                            <Image Grid.Column="1" VerticalAlignment="Top" HorizontalAlignment="Right" Visibility="{Binding Path=EarthwatcherId, Converter={StaticResource commentDeleteVisibilityConverter}}" Cursor="Hand" x:Name="btnRemove" Tag="{Binding}" MouseLeftButtonDown="BtnRemoveMouseLeftButtonDown" Height="20" Source="/Earthwatchers.UI;component/Resources/Images/delete.png" Stretch="Fill" Width="20" ToolTipService.ToolTip="{Binding Path=Comments3, Source={StaticResource Labels}}"/>
                        </Grid>
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
            </ItemsControl>
        </ScrollViewer>

        <TextBox x:Name="txtComment" Grid.Row="1" Height="52" Margin="0,0,85,0" TextWrapping="Wrap" />
        <Button x:Name="btnPost" Grid.Row="1" Click="BtnPostClick" Content="{Binding Path=Comments2, Source={StaticResource Labels}}" Style="{StaticResource GreenButton}" HorizontalAlignment="Right" Height="52" Margin="0" Width="80"/>

    </Grid>
</sdk:ChildWindow>